//package com.touchfired.common.event.handler.impl;
//
//import com.touchfired.common.constants.ClientInfo;
//import com.touchfired.common.constants.EventCode;
//import com.touchfired.common.constants.RoomInfo;
//import com.touchfired.common.context.ServerContext;
//import com.touchfired.common.message.BaseMessage;
//import com.touchfired.common.message.transfer.MessageSender;
//import io.netty.channel.Channel;
//import io.netty.channel.ChannelHandlerContext;
//import org.apache.commons.lang3.StringUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
//import java.util.List;
//import java.util.stream.Collectors;
//
///**
// * @Description 连接成功事件码处理器
// * @Author 幸佳俊
// */
//@Component
//public class EventCodeChartHandler extends BaseEventCodeHandler {
//
//    @Autowired
//    private ServerContext serverContext;
//
//    public EventCodeChartHandler() {
//        super(EventCode.CLIENT_NOTIFY);
//    }
//
//    @Override
//    public EventCodeHandler doHandle(ChannelHandlerContext ctx, ClientInfo clientInfo, BaseMessage message) throws Exception {
//        if (clientInfo != null) {
//            String roomId = clientInfo.getRoomId();
//            if (StringUtils.isNotBlank(roomId)) {
//                RoomInfo roomInfo = serverContext.getRoomInfo(roomId);
//                if (roomInfo != null) {
//                    List<Channel> clientsChannel = roomInfo.getRoomClients().stream()
//                            .map(serverContext::getClientInfo)
//                            .map(ClientInfo::getChannel)
//                            .collect(Collectors.toList());
//                    MessageSender.info(clientsChannel, message.setMessageFrom(clientInfo.getName()), message.getContent());
//                }
//            }
//        }
//        return null;
//    }
//}
